﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProgressBarHD.ascx.cs"
    Inherits="Pub_Module_ProgressBarHD" %>
<link href="<%= ResolveClientUrl("~/")%>Pub/Css/JQ/jquery-ui-1.8.13.custom.css" rel="stylesheet"
    type="text/css" />

<script src="<%= ResolveClientUrl("~/")%>Pub/Js/JQ/jquery-ui-1.8.13.custom.min.js"
    type="text/javascript"></script>

<script type="text/javascript">	
            var Url='<%= ResolveClientUrl("~/")%>';
			function ProgressBarHD(sVal)
			{			
			   $(function(){
			        		
			        sVal=sVal.replace("GB","");			       
			        if(sVal=="0") 
			        {
			            $("#newsAd").hide();
			            return;
			        }
			        else
			        {
			            $("#newsAd").show();
			          
			        }
			        percent=ReturnPercent(sVal);
		            $("#<%=lblTotalHD.ClientID %>").text(sVal+" GB");		
			        $("#progressbar").progressbar({
				        value: percent 
			        });		
			        
			        try{
			        setProgress();
			        }catch(e){}
			   });			   
			}
			
//			//Close page event
//	        $(window).unload(function() {
//               /* if(parseInt($(window).width())<=0)
//                {
//                     alert("aaa");
//                      deleteCookie("ckStateProgress");
//                }*/
//               alert($(window).width()) ;
//              
//            });   

//                   $(window).bind('beforeunload', function(){
//		          alert("bye");
//	            });

           
			
			function ReturnPercent(sVal)
			{
			    Maxsize=2000;
			    sPercent=0;
			    sVal=sVal.toUpperCase();
			    try
			    { 			      
			          
			            sPercent=parseFloat(sVal)*100/Maxsize;    			  
			        
			       /* else if(sVal.indexOf("TB")!=-1)
			        {
			             sVal=sVal.split("TB")[0];
			             sPercent=parseFloat(sVal)*100000/Maxsize;
			        }   */
			    }catch(e){}
			    return  sPercent;
			}
			
			
			
          
            
			
</script>

<style type="text/css">
/* Ad for free Newsletter */
#newsAd {
	position: fixed; 
	bottom: 0; height: 85px; 
	z-index: 9999;
}
#newsAdShow {	
	display: none; 
	position: absolute; 
	left: 0; 
	bottom: 0;
}
#newsAdShowContent {
	position: absolute; 
	width: 110px; 
	height: 26px; 
	bottom: 0px; 
	text-align: center;
	background-color: #ffff99;  
	font-size: 12px; 
	padding: 2px 5px;
	border: 3px double #000000; 
	border-bottom: none; 
	border-radius: 6px 6px 0 0;
}
#showNewsAd {
	position: relative; 
	bottom: 0; 
	left: 126px;  /* equal to newsAdShowContent's width + border widths + padding */
}
#newsAdPopup {
	position: absolute; 
	left: 0; 
	top: -1px; 
	width: 1000px; 
	height: 85px; 
	background-color: #ffff99; 
	border: 3px double #000000; 
	border-bottom: none; 
	border-radius: 6px 6px 0 0;
}
#newsAdContent {
	margin:  10px 30px 10px 100px; 
	font-size: 13px;
}
#hideNewsAd {
	position: absolute; 
	bottom: 0; 
	right: 5px;
}
#newsAdLogo {
	position: absolute; 
	top: -20px; 
	left: 8px;
}
</style>

<script type="text/javascript" language="javascript">
/****************************/
	/*  Newsletter Ad functions */
	/****************************/	
	// slides the newsletter ad up from its hidden position below the screen bottom
	function showNewsAd(intIncr, intStep) {
	
		var intIncr, intStep;
		intIncr = intIncr || 5;			// default to 5px increment
		intStep = intStep || 33;		// default to 33ms step interval

		document.getElementById("newsAdShow").style.display = 'none';
		document.getElementById("newsAdPopup").style.display = 'block';	
		if (intNewsAdTop > intNewsAdShowTop) {
			intNewsAdTop = intNewsAdTop - intIncr;
			document.getElementById("newsAdPopup").style.top = intNewsAdTop + 'px';
			setTimeout('showNewsAd();', intStep);
		}	
	}

	// slides the newsletter ad down to hide it below the screen bottom
	function hideNewsAd(intIncr, intStep) {
		var intIncr, intStep;
		intIncr = intIncr || 5;			// default to 5px increment
		intStep = intStep || 33;		// default to 33ms step interval

		if (objInitTimeout != null) {
			clearTimeout(objInitTimeout);
		}
		if (intNewsAdTop < intNewsAdHideTop) {
			intNewsAdTop = intNewsAdTop + intIncr;
			document.getElementById("newsAdPopup").style.top = intNewsAdTop + 'px';
			setTimeout('hideNewsAd();', intStep);
		}	
		else {
			document.getElementById("newsAdShow").style.display = 'block';
		}
	}

	// slides the newsletter ad up for display, delays and then hides it
	function newsAdInit(intDelay) {
		var intDelay;
		intDelay = intDelay || 5000;			// default to 5 second display

		showNewsAd();
		ProgressBarHD();
		//objInitTimeout = setTimeout('hideNewsAd();', intDelay);
	}
</script>

<div id="newsAd">
    <div id="newsAdShow" onclick="showNewsAd();">
        <div id="newsAdShowContent">
            <i><b>Dung lượng<br />
                film đã chọn</b></i>
        </div>
        <div id="showNewsAd">
            <img src="<%= ResolveUrl("~/") %>Images/Icon/newsAdShow.png" style="cursor: pointer" />
        </div>
    </div>
    <div id="newsAdPopup">
        <div id="newsAdContent">
            <table width="90%" cellpadding="0" cellspacing="0" class="tblProgressBar">
                <tr>
                    <td style="height: 25px">
                        <div id="progressbar" style="height: 20px;">
                        </div>
                    </td>
                    <td align="center" style="width: 1%; white-space: nowrap; text-align: center; vertical-align: middle;
                        padding: 2px 2px 2px 5px">
                        <ul class="fixUlBlock">
                            <li>
                                <asp:Label ID="Label1" runat="server" Text="DUNG LƯỢNG ĐÃ CHỌN" Font-Size="11px"></asp:Label>
                            </li>
                            <li style="text-align: center">
                                <asp:Label ID="lblTotalHD" Style="font-size: 16px; font-family: Verdana; font-weight: bold"
                                    runat="server" Text="0 GB" CssClass="csslblTotalHD" ForeColor="DarkRed"></asp:Label>
                            </li>
                            <li style="text-align: center">
                               
                                    <a style="width:80px" class="ovalbutton" href="<%= ResolveUrl("~/")%>CartFilm/F.aspx"><span>Chọn xong</span></a>
                               
                            </li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table width="100%" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="text-align: left">
                                    0
                                </td>
                                <td style="width: 25%; text-align: right">
                                    500GB
                                </td>
                                <td style="width: 25%; text-align: right">
                                    1TB
                                </td>
                                <td style="width: 25%; text-align: right">
                                    1,5TB
                                </td>
                                <td style="width: 25%; text-align: right">
                                    2TB
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
        </div>
        <div id="hideNewsAd" onclick="hideNewsAd();">
            <img src="<%= ResolveUrl("~/") %>Images/Icon/newsAdHide.png" style="cursor: pointer" />
        </div>
        <div id="newsAdLogo">
            <img src="<%= ResolveUrl("~/") %>Images/Icon/hd-logo-new.png" width="90" height="90" />
        </div>
    </div>
</div>

<script type='text/javascript' language="javascript">
		intNewsAdIncr = 5;
		intNewsAdStep = 33;
		intNewsAdInitDelay = 2000;
		intNewsAdDisplayDelay = 5000;
		intNewsAdHeight = parseInt(document.getElementById("newsAdPopup").offsetHeight) + 31;
		intNewsAdShowTop = parseInt(document.getElementById("newsAdPopup").offsetTop); 
		intNewsAdHideTop = intNewsAdShowTop + intNewsAdHeight;
		intNewsAdTop = intNewsAdHideTop;
		document.getElementById("newsAdPopup").style.top = intNewsAdTop + 'px';
		objInitTimeout = setTimeout('newsAdInit();', intNewsAdInitDelay);
</script>

